#include "a28_t2g4a27d1a.h"

/**
 * @brief  Send parameters to RF moudle. There is no need
 * to call this function every time, just call it once when the
 * module is NEW.
 */
void A28_T2G4A27D1a_Config(void)
{
    //配置模式，MD0=1,MD1=1，串口默认9600 8N1
    HAL_GPIO_WritePin(AS_MD0_GPIO_Port, AS_MD0_Pin, GPIO_PIN_SET);
    HAL_GPIO_WritePin(AS_MD1_GPIO_Port, AS_MD1_Pin, GPIO_PIN_SET);
    HAL_Delay(100);
    
    UART_Set_BoundRate(&A28_UART_Handle, 9600);

    /*透明传输 115200 8N1 无前导唤醒码 空速62.5k 打包长度64Bytes*/   
    const uint8_t config_data[6] = {0xC0, 0x12, 0x34, 0x38, 0x00, 0x43};
    
    HAL_UART_Transmit(&A28_UART_Handle, config_data, 6, 1000);
    HAL_Delay(100);

    UART_Set_BoundRate(&A28_UART_Handle, 115200);
}

/**
 * @brief  Initialize the RF module into dulpex mode.
 * @note   This function should be called once at power on.
 */
void A28_T2G4A27D1a_Init(void)
{
    HAL_GPIO_WritePin(AS_MD0_GPIO_Port, AS_MD0_Pin, GPIO_PIN_RESET);
    HAL_GPIO_WritePin(AS_MD1_GPIO_Port, AS_MD1_Pin, GPIO_PIN_SET);
    HAL_Delay(100);
}